﻿namespace E6BTest
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using PocketE6B.Engine;

    /// <summary>
    /// Tests the MathEx methods.
    /// </summary>
    [TestClass]
    public class MathExTests
    {
        /// <summary>
        /// Tests an angle value greater than 360 degrees.
        /// </summary>
        [TestMethod]
        public void CoterminalAngleGT360Test()
        {
            double angle = 450;
            double expected = 90;
            double actual = Trig.NormalizeAngle(angle);
            Assert.AreEqual<double>(expected, actual);
        }

        /// <summary>
        /// Tests an angle value less than 360 degrees.
        /// </summary>
        [TestMethod]
        public void CoterminalAngleLT360Test()
        {
            double angle = -580;
            double expected  = -220;
            double actual = Trig.NormalizeAngle(angle);
            Assert.AreEqual<double>(expected, actual);
        }

        /// <summary>
        /// Tests an angle value much greater than 360 degrees.
        /// </summary>
        [TestMethod]
        public void LargeCoterminalAngleGT360Test()
        {
            double angle = 1450;
            double expected = 10;
            double actual = Trig.NormalizeAngle(angle);
            Assert.AreEqual<double>(expected, actual);
        }

        /// <summary>
        /// Tests an angle value much less than 360 degrees.
        /// </summary>
        [TestMethod]
        public void LargeCoterminalAngleLT360Test()
        {
            double angle = -1580;
            double expected = -140;
            double actual = Trig.NormalizeAngle(angle);
            Assert.AreEqual<double>(expected, actual);
        }

        /// <summary>
        /// Tests an angle value which is within the standard bounds of
        /// -2PI to 2PI.
        /// </summary>
        [TestMethod]
        public void CoterminalAngleWithin360()
        {
            double angle = 50;
            double expected = 50;
            double actual = Trig.NormalizeAngle(angle);
            Assert.AreEqual<double>(expected, actual);
        }
    }
}